package com.liuyang.concurrency.chapter8;

public class DeadLock {
    private OhterService ohterService ;
    private final Object lock = new Object();

    public DeadLock(OhterService ohterService){
        this.ohterService = ohterService;
    }


    public void m1(){
        synchronized (lock){
            System.out.println("m1==============");
            ohterService.s1();
        }
    }

    public void m2(){
        synchronized (lock){
            System.out.println("m2==============");
            ohterService.s2();
        }
    }
}
